--- a/sendmail/Makefile.m4
+++ b/sendmail/Makefile.m4
@@ -71,6 +71,7 @@ install-set-user-id: bldCURRENT_PRODUCT
 	${INSTALL} -c -o ${S`'BINOWN} -g ${S`'BINGRP} -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}
 	for i in ${sendmailTARGET_LINKS}; do \
 		rm -f $$i; \
+		mkdir -p $$(dirname $$i); \
 		${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \
 	done
 
@@ -79,6 +80,7 @@ install-sm-mta: bldCURRENT_PRODUCT
 	${INSTALL} -c -o ${M`'BINOWN} -g ${M`'BINGRP} -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta
 	for i in confMTA_LINKS; do \
 		rm -f $$i; \
+		mkdir -p $$(dirname $$i); \
 		${LN} ${LNOPTS} ${M`'BINDIR}/sm-mta $$i; \
 	done
 
--- a/devtools/M4/UNIX/links.m4
+++ b/devtools/M4/UNIX/links.m4
@@ -23,6 +23,7 @@ define(`bldMAKE_SOURCE_LINKS',
 define(`bldMAKE_TARGET_LINKS',
 `	for i in $2; do \
 		rm -f $$i; \
+		mkdir -p $$(dirname $$i); \
 		ln -s $1 $$i; \
 	done'
 )dnl
--- a/cf/cf/Makefile
+++ b/cf/cf/Makefile
@@ -80,9 +80,11 @@ install:
 install-cf:  install-sendmail-cf install-submit-cf
 
 install-sendmail-cf: $(CF).cf
+	mkdir -p ${DESTDIR}$(MAILDIR)
 	$(INSTALL) -c -m $(CFMODE) $(CF).cf ${DESTDIR}$(MAILDIR)/sendmail.cf
 
 install-submit-cf: $(SUBMIT).cf
+	mkdir -p ${DESTDIR}$(MAILDIR)
 	$(INSTALL) -c -m $(CFMODE) $(SUBMIT).cf ${DESTDIR}$(MAILDIR)/submit.cf
 
 depend:
